package org.groupg.filetodb;

import cn.hutool.core.date.TimeInterval;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;

public class CSVTest {

    static final File file = new File("E:\\Develop\\demo001-4kw.csv");
    @Test
    public void test() throws IOException {
        TimeInterval  timeInterval = new TimeInterval();
        timeInterval.start();
        try (Reader reader = Files.newBufferedReader(file.toPath());
             CSVParser parser = new CSVParser(reader, CSVFormat.DEFAULT)) {

//            while (parser.iterator().hasNext()) {
//                CSVRecord record = parser.iterator().next();
////                System.out.println(record);
//            }
        }
        long interval = timeInterval.interval();
        System.out.println(interval);
        Assert.assertTrue((120*60)>(interval));
    }
}
